<template>
	<view class="content">
		<view class="navbar">
			<view 
				v-for="(item, index) in navList" :key="index" 
				class="nav-item" 
				:class="{current: tabCurrentIndex === index}"
				@click="tabClick(index)"
			>
				{{item.text}}
			</view>
		</view>
		<swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
			<swiper-item class="tab-content" v-for="(tabItem,tabIndex) in navList" :key="tabIndex">
				<scroll-view 
					class="list-scroll-content" 
					scroll-y
					@scrolltolower="loadData"
				>
					<!-- 空白页 -->
					<empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
					
					<!-- 订单列表 -->
					<view 
						v-for="(item,index) in tabItem.orderList" :key="index"
						class="order-item"
						
					>
						<view class="i-top b-b" @click="navToDetail(item)">
							<view class="" style="width: 500upx;">
								<view style="font-size: 28upx;">
									订单号：{{item.ORDERNUM}}
								</view>
							</view>
							
							<view class="state" v-if="item.ORDERSTATE == 1">
								<text  :style="{color: item.stateTipColor}">待付款</text>
							</view>
							<view class="state" v-if="item.ORDERSTATE == 2">
								<text  :style="{color: item.stateTipColor}">待出库</text>
							</view>
							<view class="state" v-if="item.ORDERSTATE == 3 ">
								<text  :style="{color: item.stateTipColor}">待评价</text>
							</view>
							<view class="state" v-if="item.ORDERSTATE == 4">
								<text  :style="{color: item.stateTipColor}">已完成</text>
							</view>
							<view class="state" v-if="item.ORDERSTATE == 6">
								<text  :style="{color: item.stateTipColor}">待收货</text>
							</view>
							<view class="state" v-if="item.ORDERSTATE == 7">
								<text  :style="{color: item.stateTipColor}">已退款</text>
							</view>
							<view style="width: 150upx;text-align: right;" v-if="item.ORDERSTATE == 9">
								<text  :style="{color: item.stateTipColor}">已关闭</text>
							</view>
							<text
								v-if="item.ORDERSTATE === 9" 
								class="del-btn yticon icon-iconfontshanchu1"
								@click="deleteOrder(item,item.GROUP)"
							></text>
						</view>
						
						<view 
							class="goods-box-single"
							v-for="(goodsItem, goodsIndex) in item.LIST" :key="goodsIndex"
							@click="navToDetail(item)"
						> 
						<!-- @click="navTo('/pages/product/product?id='+goodsItem.GOODSID)" -->
							<image class="goods-img" :src="goodsItem.THUMB" mode="aspectFill" ></image>
							<view class="right">
								<text class="title clamp">{{goodsItem.NAME}}</text>
								<text class="attr-box " v-if="item.EXCHANGE==undefined && item.GROUP == undefined">{{goodsItem.SHORTINFO}}  x {{goodsItem.COUNT}}</text>
								<text class="attr-box " v-else >{{goodsItem.SHORTINFO}}  x {{item.COUNTNUM}}</text>
								<text class="price"  v-if="item.EXCHANGE==undefined && item.ISSPIKE==0">{{goodsItem.PRICE}}</text>
								<text class="price"  v-if="item.EXCHANGE==undefined && item.ISSPIKE==1">{{item.AMOUNT}}</text>
								<view class="" v-else>
									<view class="" v-if="goodsItem.MULTIPAY==2" >
										<text  class="price1" v-if="goodsItem.OPPOINT>0">积分:{{goodsItem.OPPOINT}}</text>
										<text  class="price1"  v-if="goodsItem.OPDEDU>0">抵扣券:{{goodsItem.OPDEDU}}</text>
										<text  class="price1"  v-if="goodsItem.OPCOUPON>0">优惠券:{{goodsItem.OPCOUPON}}</text>
									</view>
									<view class="" v-else >
										<text  class="price"  v-if="goodsItem.MUCHSELLERPRICE>0">{{goodsItem.MUCHSELLERPRICE}}</text>
										<text  class="price1"  v-if="goodsItem.MPPOINT>0">+积分:{{goodsItem.MPPOINT}}</text>
										<text  class="price1"  v-if="goodsItem.MPDEDU>0">+抵扣券:{{goodsItem.MPDEDU}}</text>
										<text  class="price1"  v-if="goodsItem.MPCOUPON>0">+优惠券:{{goodsItem.MPCOUPON}}</text>
									</view>
								</view>
							</view>
						</view>
					
						<view class="price-box" @click="navToDetail(item)">
							共
							<text class="num" >{{item.LIST.length}}</text>
							件商品 实付款
							<text class="price">{{item.AMOUNT}}</text>
						</view>
						<view class="action-box b-t" v-if="item.ORDERSTATE == 1">
							<view class="time" v-if="tabCurrentIndex==4" >时间：{{item.STARTDATETIME}}</view>
							<view class="time" v-else @click="navToDetail(item)">时间：{{item.STARTDATETIME}}</view>
							<view class="" style="display: flex;">
								<button class="action-btn"  @tap="chooseExcuse(item,item.GROUP )">取消订单</button>
								<button class="action-btn recom" @click="pay(item,item.GROUP)">立即支付</button>
							</view>
							
						</view>
						<view class="action-box b-t" v-if="item.ORDERSTATE == 2 || item.ORDERSTATE == 6">
							<view class="time" v-if="tabCurrentIndex==4" >时间：{{item.STARTDATETIME}}</view>
							<view class="time" v-else @click="navToDetail(item)">时间：{{item.STARTDATETIME}}</view>
							<view >
								<button class="action-btn recom" v-if="item.ORDERSTATE == 6" @click="sure(item,item.GROUP )">确认收货</button>
							</view>
						</view>
						<view class="action-box b-t" v-if="item.ORDERSTATE == 3">
							<view class="time" v-if="tabCurrentIndex==4" >时间：{{item.STARTDATETIME}}</view>
							<view class="time" v-else @click="navToDetail(item)">时间：{{item.STARTDATETIME}}</view>
							<view class="">
								<button class="action-btn recom" @click="comment(item,item.GROUP )">立即评价</button>
							</view>
						</view>
						<view class="action-box b-t" v-if="item.ORDERSTATE == 4">
							<view class="time" v-if="tabCurrentIndex==4" >时间：{{item.STARTDATETIME}}</view>
							<view class="time" v-else @click="navToDetail(item)">时间：{{item.STARTDATETIME}}</view>
							<view class="">
								<!-- #ifdef MP-WEIXIN -->
								<button class="action-btn recom" open-type="share"  :data-goods="item.LIST[0]">立即分享</button>
								<!-- #endif -->
								<!-- #ifdef H5 -->
								<!-- <button v-if="isWechat"  class="action-btn recom"  @click="publicShare(item.LIST[0],item.USERID)">立即分享</button> -->
								<!-- <button v-if="isWechat"  class="action-btn recom"  @click="toTeam(item)">立即分享</button> -->
								<!-- <button v-else class="action-btn recom" @click="togglePopup('two',item.LIST[0].ID,item.USERID)">立即分享</button> -->
								<button class="action-btn recom" @click="toTeam(item)">立即分享</button>
								<!-- #endif -->
							</view>
						</view>
						<view class="action-box b-t" v-if="item.ORDERSTATE == 9 ||item.ORDERSTATE == 7">
							<view class="time" v-if="tabCurrentIndex==4" >时间：{{item.STARTDATETIME}}</view>
							<view class="time" v-else @click="navToDetail(item)">时间：{{item.STARTDATETIME}}</view>
						</view>
					</view>
					 
					<uni-load-more v-if="tabItem.orderList.length!=0" :status="tabItem.loadingType"   ></uni-load-more>
					
				</scroll-view>
			</swiper-item>
		</swiper>
		 <w-picker  v-if="selectList.length!=0" mode="selector"  :defaultVal="[0]"  @confirm="onConfirm"  ref="selector"  themeColor="#f00" :selectList="selectList" ></w-picker>
	
	<!-- #ifdef H5 -->
	<uni-popup  class="" :show="type==='two'"  position="middle"  mode="fixed"   @hidePopup="togglePopup('')">
		<view class="share">
			<view class="">快喊朋友一起拼团吧</view>
			<view class="qrimg-i">
				<tki-qrcode   ref="qrcode" :val="val" :onval="onval" :size="size" :unit="unit" :loadMake="loadMake" :usingComponents="true" @result="qrR" />
			</view>
		</view>
	</uni-popup>
	 <!-- #endif -->
	
	</view>
</template> 

<script>
	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
	import empty from "@/components/empty";
	import Json from '@/Json';
	import wPicker from "@/components/w-picker/w-picker.vue";
	// #ifdef H5
	import uniPopup from '@/components/uni-popup/uni-popup.vue';
	import tkiQrcode from '@/components/tki-qrcode/tki-qrcode.vue'  //仅H5
	var jweixin = require('../../common/jweixin-1.4.0.js');
	// 判断是否为公众号模拟器环境
	const isWechat = () => {
		return String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i)) === "micromessenger";
	}
	
	//获取微信公众号的配置
	// const publicShare1=(goods)=>{
	// 	console.log("进入方法未发送请求")
	// 	uni.request({
	// 		url: getApp().globalData.http+'/common/getConfig', //仅为示例，并非真实接口地址。
	// 		data: {
	// 			SIGNATURE : uni.getStorageSync('SIGNATURE'),
	// 			URL:window.location.href,
	// 		},
	// 		header: {
	// 			'content-type':'application/x-www-form-urlencoded',
	// 		},
	// 		success: (s) => {
				
	// 			console.log('发送请求成功',s);
				
	// 			jweixin.config({
	// 				 debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
	// 				 appId: s.data.OBJECT.APPID, // 必填，公众号的唯一标识
	// 				 timestamp: s.data.OBJECT.TIMESTAMP, // 必填，生成签名的时间戳
	// 				 nonceStr: s.data.OBJECT.NONCESTR, // 必填，生成签名的随机串
	// 				 signature: s.data.OBJECT.SIGNATURE, // 必填，签名，见附录1
	// 				 jsApiList: ['updateAppMessageShareData','updateTimelineShareData']
	// 			});	
	// 			jweixin.ready(function(){
	// 			// TODO
	// 				console.log("进入ready方法",goods)
	// 				var userid='undefined';
	// 				if(uni.getStorageSync('userInfo')&&uni.getStorageSync('userInfo').USER&&uni.getStorageSync('userInfo').USER.ID){
	// 					userid = uni.getStorageSync('userInfo').USER.ID
	// 				}
	// 				jweixin.updateAppMessageShareData({
	// 					title: goods.NAME, // 分享标题				 
	// 					desc: goods.SHORTINFO, // 分享描述				 
	// 					link: getApp().globalData.http+ '/h5/#/pages/product/productGroup?ID='+goods.ID+'&userId='+ userid, // 分享链接				 
	// 					imgUrl: goods.THUMB, // 分享图标				 
	// 					success: function () {
	// 						// 用户确认分享后执行的回调函数				
	// 						 uni.showModal({
	// 						 	content:"请点击右上角 ··· 进行分享",
	// 						 })
	// 					},				 
	// 				});	
	// 				jweixin.updateTimelineShareData({
	// 					title: goods.NAME, // 分享标题				 
	// 					desc: goods.SHORTINFO, // 分享描述				 
	// 					link: getApp().globalData.http+ '/h5/#/pages/product/productGroup?ID='+goods.ID+'&userId='+ userid, // 分享链接				 
	// 					imgUrl: goods.THUMB, // 分享图标				 
	// 					success: function () {
	// 						// 用户确认分享后执行的回调函数				
	// 						 uni.showModal({
	// 						 	content:"请点击右上角 ··· 进行分享",
	// 						 })
	// 					},				 
	// 				});	
	// 			})
	// 		}
	// 	})
	// }
	
	
	// #endif
	export default {
		components: {
			uniLoadMore,
			empty,
			wPicker,
			// #ifdef H5
			uniPopup,
			tkiQrcode
			// #endif
		},
		data() {
			return {
				tabCurrentIndex: 0,
				navList: [{
						state: 0,
						text: '全部',
						loadingType: 'loading',
						orderList: []
					},
					{
						state: 1,
						text: '待付款',
						loadingType: 'loading',
						orderList: []
					},
					
					{
						state: 2,
						text: '待收货',
						loadingType: 'loading',
						orderList: []
					},
					{
						state: 3,
						text: '待评价',
						loadingType: 'loading',
						orderList: []
					},
					{
						state: 4,
						text: '待分享',
						loadingType: 'loading',
						orderList: []
					},
				],
				// #ifdef H5
				val: '', // 要生成的二维码值
				size: 300, // 二维码大小
				unit: 'upx', // 单位
				onval: true,
				loadMake: true, // 组件加载完成后自动生成二维码
				src: '' ,// 二维码生成后的图片地址或base64
				type:'',
				// #endif
				mode:'',
				selectList:[
					{label:"配送信息有误",value:"1"},
					{label:"发票信息有误",value:"2"},
					{label:"忘记使用惠券、积分等",value:"3"},
					{label:"商品买错了",value:"4"},
					{label:"重复下单/误下单",value:"5"},
				],
				ORDERNUM: '',
				EXCHANGE: '',
				isSpike: 0,
				isWechat:false
			};
		},
		
		onLoad(options){
			// #ifdef H5
			console.log('isWechat():', isWechat(),options);
			if (isWechat()) {
				this.isWechat=true;
			}
			// #endif
			/**
			 * 修复app端点击除全部订单外的按钮进入时不加载数据的问题
			 * 替换onLoad下代码即可
			 */
			this.tabCurrentIndex = +options.state;
			// #ifndef MP
			this.loadData()
			// #endif
			// #ifdef MP
			if(options.state == 0){
				this.loadData()
			}
			// #endif
			uni.startPullDownRefresh();
			// #ifdef MP-WEIXIN
			uni.hideShareMenu()
			// #endif
		},
		onPullDownRefresh() {
			console.log('refresh');
			setTimeout(function () {
				uni.stopPullDownRefresh();
			}, 2000);
		},
		
		// #ifdef MP-WEIXIN
		//小程序分享事件
		onShareAppMessage(res) {
		      return {
		        title: res.target.dataset.goods.NAME,
		        path:'/pages/product/productGroup?ID='+res.target.dataset.goods.ID+'&userid='+ uni.getStorageSync('userInfo').USER.ID,
				imageUrl:res.target.dataset.goods.THUMB
		      }
		},
		// #endif
		methods: {
			//跳转详情页
			navToDetail(item){
				uni.navigateTo({
					url:'/pages/orderdetail/orderdetail?ORDERNUM='+item.ORDERNUM+'&state='+item.ORDERSTATE+'&index='+this.tabCurrentIndex+'&EXCHANGE='+(item.GROUP == undefined? ((item.EXCHANGE==undefined ? '0':'1')) :'2')
				})
			},
			
			
			toTeam(Order) {
				console.log("+>>>>>>>>>>>>>>>",Order);
				// #ifndef MP-WEIXIN
				uni.showLoading({
					title: '请稍后'
				})
				// #endif
				
				this.$http.post("/group/beTeam",{
					SIGNATURE : uni.getStorageSync("SIGNATURE"),
					TOKEN: uni.getStorageSync('userInfo').TOKEN,
					ORDERID: Order.ID,
				}).then(e=>{
					console.log("********/",e);
					if( e.data.STATE === '0' && e.statusCode === 200){
						uni.hideLoading();
						uni.showModal({
							content:'去分享？',
							success: function (res) {
							        if (res.confirm) {
							            uni.redirectTo({
							            	url: '/pages/product/productGroup?ID='+Order.LIST[0].ID+'&userId='+Order.USERID+'&isOrder=0'
							            })
							        } else if (res.cancel) {
							            uni.redirectTo({
							            	url: '/pages/order/order?state=4'
							            })
							        }
							    }
						})
						
					}else{
						uni.showToast({title:'网络异常，请稍后重试', icon:"none"});
					}
				}).catch(err =>{
					console.log('request fail', err);
				})
			},
			
			
			// #ifdef H5
			qrR(res) {
				this.src = res;
			},
			togglePopup(type,id,userid){
				this.type = type
				let count = getApp().globalData.http+ '/h5/#/pages/product/productGroup?ID='+id+'&userid='+ userid
				this.val =count
				console.log(id)
			},
			
			//公众号分享
			// publicShare(goods,userid){
			// 	console.log("点击了分享")
			// 	publicShare1(goods)
			// },
			
			// #endif
			//获取订单列表
			loadData(source){
				//这里是将订单挂载到tab列表下
				let index = this.tabCurrentIndex;
				let navItem = this.navList[index];
				let state = navItem.state;
				if(source === 'tabChange' && navItem.loaded === true){
					//tab切换只有第一次需要加载数据
					return;
				}
				if(navItem.loadingType === 'noMore'){
					//防止重复加载
					return;
				}
				//查询订单列表
				this.$http.post("/order/list",{
					SIGNATURE : uni.getStorageSync("SIGNATURE"),
					TOKEN: uni.getStorageSync('userInfo').TOKEN,
					FLAG: this.tabCurrentIndex,
				}).then(e=>{
					
					if(e.data.STATE === '0' && e.statusCode === 200){
						var list = e.data.OBJECT;
						console.log("********LLLLLLLLLLLLLLLLLLLL/",e);
						var newlist = list.map(item=>{
							if(item.LIST!=undefined && item.LIST != null){
								item.LIST.map(item1=>{
									console.log("********LLLLLLLLLLLLLLLLLLLL121212/",item1.THUMB);
									if(item1.THUMB != null){
										item1.THUMB=getApp().globalData.imageAddress+item1.THUMB;
									}
								})
							}
							if(this.tabCurrentIndex == 4){
								item.ORDERSTATE = 4;
							}
							//添加不同状态下订单的表现形式
							item = Object.assign(item, this.orderStateExp(item.ORDERSTATE));
							return item;
						})
						console.log("********LLLLLLLLLLLLLLLLLLLL/",newlist);
						// newlist.sort((a,b)=>{
						// 	return new Date(b.STARTDATE) - new Date(a.STARTDATE)
						// })
						newlist.forEach(item=>{
							navItem.orderList.push(item);
						})
					}else{
						uni.showToast({title:e.data.MSG, icon:"none"});
					}
				}).catch(err =>{
					console.log('request fail', err);
				})
				//判断是否还有数据， 有改为 more， 没有改为noMore 
				navItem.loadingType = 'noMore';
			}, 
			//跳转
			navTo(url){
				uni.navigateTo({  
					url,
				})  
			}, 
			//swiper 切换
			changeTab(e){
				this.tabCurrentIndex = e.target.current;
				this.loadData('tabChange');
			},
			//顶部tab点击
			tabClick(index){
				this.tabCurrentIndex = index;
			},
			//评价
			comment(item,group){
				uni.redirectTo({
					url: '/pages/comment/createComment?ORDERNUM=' + item.ORDERNUM 
				})
			},
			//支付
			pay(item,group){
				if(group==undefined){
					//跳转支付
					uni.redirectTo({
						url: '/pages/money/pay?ORDERNUM=' + item.ORDERNUM + "&AMOUNT=" + item.AMOUNT + "&check=1"
					})
				}else{
					//跳转支付
					uni.redirectTo({
						url: '/pages/money/pay?ORDERNUM=' + item.ORDERNUM + "&AMOUNT=" + item.AMOUNT + "&check=1&group=1"
					})
				}
				
			},
			//删除订单
			deleteOrder(item,group){
				// #ifndef MP-WEIXIN
				uni.showLoading({
					title: '请稍后'
				})
				// #endif
				
				if(item.EXCHANGE==undefined && group == undefined){
					this.EXCHANGE = '0'
				}else if(group!=undefined){
					this.EXCHANGE = '2'
				}else{
					this.EXCHANGE = '1'
				}
				//删除订单
				this.$http.post("/order/delete",{
					SIGNATURE : uni.getStorageSync("SIGNATURE"),
					TOKEN: uni.getStorageSync('userInfo').TOKEN,
					ORDERNUM: item.ORDERNUM,
					ISREDEEM: this.EXCHANGE
				}).then(e=>{
					if(e.data.STATE == '903'||e.data.STATE == '904'){
						uni.navigateTo({
							url:'/pages/public/login1'
						})
					}
					if(e.data.STATE === '0' && e.statusCode === 200){
						uni.hideLoading();
						// let count = this.navList[this.tabCurrentIndex].orderList.filter(item1=>item1.ID == item.ID)
						// console.log("6666666",count)
						let count = 0
						this.navList[this.tabCurrentIndex].orderList.forEach(item1=>{
							if(item1.ID == item.ID){
								this.navList[this.tabCurrentIndex].orderList.splice(count,1)
							}
							count++
						})
					}else{
						uni.showToast({title:e.data.MSG, icon:"none"});
					}
				}).catch(err =>{
					console.log('request fail', err);
				})
			},
			//选择取消原因
			chooseExcuse(item,group){
				this.isSpike = item.ISSPIKE;
				this.ORDERNUM = item.ORDERNUM;
				if(item.EXCHANGE==undefined && group == undefined){
					this.EXCHANGE = '0'
				}else if(group!=undefined){
					this.EXCHANGE = '2'
				}else{
					this.EXCHANGE = '1'
				}
				this.mode='selector';
				this.$refs[this.mode].show();
			},
			//取消订单 
			onConfirm(val){
				// #ifndef MP-WEIXIN
				uni.showLoading({
					title: '请稍后'
				})
				// #endif
				
				this.$http.post("/order/cancel",{
					SIGNATURE : uni.getStorageSync("SIGNATURE"),
					TOKEN: uni.getStorageSync('userInfo').TOKEN,
					ORDERNUM: this.ORDERNUM,
					REASON: val.result,
					ISREDEEM: this.EXCHANGE,
					ISSPIKE:this.isSpike
				}).then(e=>{
					if(e.data.STATE == '903'||e.data.STATE == '904'){
						uni.navigateTo({
							url:'/pages/public/login1'
						})
					}
					if(e.data.STATE === '0' && e.statusCode === 200){
						// this.loadData();
						uni.hideLoading();
						uni.redirectTo({
							url: '/pages/order/order?state=' + this.tabCurrentIndex
						})
					}else{
						uni.showToast({title:e.data.MSG, icon:"none"});
					}
				}).catch(err =>{
					console.log('request fail', err);
				})
			},
			
			//确认收货
			sure(item,group){
				uni.showModal({
						content: '确认收货？',
						success: (e)=>{
							if(e.confirm){
								// #ifndef MP-WEIXIN
								uni.showLoading({
									title: '请稍后'
								})
								// #endif
								
								//确认收货
								this.$http.post("/order/receive",{
									SIGNATURE : uni.getStorageSync("SIGNATURE"),
									TOKEN: uni.getStorageSync('userInfo').TOKEN,
									ORDERNUM: item.ORDERNUM,
									ISREDEEM: group==1? '2' : item.EXCHANGE==undefined ? '0':'1'
								}).then(e=>{
									if(e.data.STATE == '903'||e.data.STATE == '904'){
										uni.navigateTo({
											url:'/pages/public/login1'
										})
									}
									if(e.data.STATE === '0' && e.statusCode === 200){
										uni.hideLoading();
										console.log("*******",e);
										uni.redirectTo({
											url: '/pages/order/order?state=' + this.tabCurrentIndex
										})
									}else{
										uni.showToast({title:e.data.MSG, icon:"none"});
									}
								}).catch(err =>{
									console.log('request fail', err);
								})
								
							}
						}
					})
			},
			
			//订单状态文字和颜色
			orderStateExp(state){
				let stateTip = '',
					stateTipColor = '#f83e3e';
				switch(+state){
					case 1:
						stateTip = '待付款'; break;
					case 2:
						stateTip = '待发货'; break;
					case 9:
						stateTip = '已关闭'; 
						stateTipColor = '#909399';
						break;
						
					//更多自定义
				}
				return {stateTip, stateTipColor};
			}
		},
	}

</script>

<style lang="scss">
	page, .content{
		background: $page-color-base;
		height: 100%;
	}
	
	.swiper-box{
		height: calc(100% - 40px);
	}
	.list-scroll-content{
		height: 100%;
	}
	/* #ifdef H5 */
	.share{
		text-align: center;
		color: #E02E24;
		background: #fff;
		height:520upx;
		width: 500upx;
		border: 5upx solid #F0AD4E;
		background: rgba(0, 0, 0, 0.05);
		.qrimg-i{
			position: absolute;
			padding: 10upx 30upx 30upx 30upx;
			margin: -230upx 10upx 0upx 70upx;
		}
	}
	/* #endif */
	.navbar{
		display: flex;
		height: 40px;
		padding: 0 5px;
		background: #fff;
		box-shadow: 0 1px 5px rgba(0,0,0,.06);
		position: relative;
		z-index: 10;
		.nav-item{
			flex: 1;
			display: flex;
			justify-content: center;
			align-items: center;
			height: 100%;
			font-size: 15px;
			color: $font-color-dark;
			position: relative;
			&.current{
				color: $base-color;
				&:after{
					content: '';
					position: absolute;
					left: 50%;
					bottom: 0;
					transform: translateX(-50%);
					width: 44px;
					height: 0;
					border-bottom: 2px solid $base-color;
				}
			}
		}
	}

	
	.order-item{
		display: flex;
		flex-direction: column;
		padding-left: 30upx;
		background: #fff;
		margin-top: 16upx;
		.i-top{
			display: flex;
			align-items: center;
			height: 80upx;
			padding-right:30upx;
			font-size: $font-base;
			color: $font-color-dark;
			position: relative;
			
			.state{
				width: 200upx;
				text-align: right;
			}
			.del-btn{
				padding: 10upx 0 5upx 36upx;
				font-size: $font-lg;
				color: $font-color-light;
				position: relative;
				&:after{
					content: '';
					width: 0;
					height: 30upx;
					border-left: 1px solid $border-color-dark;
					position: absolute;
					left: 10upx;
					top: 50%;
					transform: translateY(-50%);
				}
			}
		}
		/* 多条商品 */
		.goods-box{
			height: 160upx;
			padding: 20upx 0;
			white-space: nowrap;
			.goods-item{
				width: 120upx;
				height: 120upx;
				display: inline-block;
				margin-right: 24upx;
			}
			.goods-img{
				display: block;
				width: 100%;
				height: 100%;
			}
		}
		/* 单条商品 */
		.goods-box-single{
			display: flex;
			padding: 20upx 0;
			.goods-img{
				display: block;
				width: 120upx;
				height: 120upx;
			}
			.right{
				flex: 1;
				display: flex;
				flex-direction: column;
				padding: 0 30upx 0 24upx;
				overflow: hidden;
				.title{
					font-size: $font-base + 2upx;
					color: $font-color-dark;
					line-height: 1;
					padding: 0upx 12upx;
				}
				.attr-box{
					font-size: $font-sm + 2upx;
					color: $font-color-light;
					padding: 10upx 12upx;
				}
				.price{
					font-size: $font-base + 2upx;
					color: $font-color-dark;
					&:before{
						content: '￥';
						font-size: $font-sm;
						margin: 0 2upx 0 8upx;
					}
				}
				.price1{
					font-size: $font-base + 2upx;
					color: $font-color-dark;
				}
			}
		}
		
		.price-box{
			display: flex;
			justify-content: flex-end;
			align-items: baseline;
			padding: 20upx 30upx;
			font-size: $font-sm + 2upx;
			color: $font-color-light;
			.num{
				margin: 0 8upx;
				color: $font-color-dark;
			}
			.price{
				font-size: $font-lg;
				color: $font-color-dark;
				&:before{
					content: '￥';
					font-size: $font-sm;
					margin: 0 2upx 0 8upx;
				}
			}
		}
		.action-box{
			display: flex;
			justify-content: flex-end;
			align-items: center;
			height: 100upx;
			position: relative;
			padding-right: 30upx;
			-webkit-justify-content: space-between;
			justify-content: space-between;
			.time{
				flex: 1;
				font-size: 25upx;
				color: #666666;
			}
		}
		.action-btn{
			width: 160upx;
			height: 60upx;
			margin: 0;
			margin-left: 24upx;
			padding: 0;
			text-align: center;
			line-height: 60upx;
			font-size: $font-sm + 2upx;
			color: $font-color-dark;
			background: #fff;
			border-radius: 100px;
			&:after{
				border-radius: 100px;
			}
			&.recom{
				background: #fff9f9;
				color: #f83e3e;
				&:after{
					border-color: #f7bcc8;
				}
			}
		}
	}
	
	
	/* load-more */
	.uni-load-more {
		display: flex;
		flex-direction: row;
		height: 80upx;
		align-items: center;
		justify-content: center
	}
	
	.uni-load-more__text {
		font-size: 28upx;
		color: #999
	}
	
	.uni-load-more__img {
		height: 24px;
		width: 24px;
		margin-right: 10px
	}
	
	.uni-load-more__img>view {
		position: absolute
	}
	
	.uni-load-more__img>view view {
		width: 6px;
		height: 2px;
		border-top-left-radius: 1px;
		border-bottom-left-radius: 1px;
		background: #999;
		position: absolute;
		opacity: .2;
		transform-origin: 50%;
		animation: load 1.56s ease infinite
	}
	
	.uni-load-more__img>view view:nth-child(1) {
		transform: rotate(90deg);
		top: 2px;
		left: 9px
	}
	
	.uni-load-more__img>view view:nth-child(2) {
		transform: rotate(180deg);
		top: 11px;
		right: 0
	}
	
	.uni-load-more__img>view view:nth-child(3) {
		transform: rotate(270deg);
		bottom: 2px;
		left: 9px
	}
	
	.uni-load-more__img>view view:nth-child(4) {
		top: 11px;
		left: 0
	}
	
	.load1,
	.load2,
	.load3 {
		height: 24px;
		width: 24px
	}
	
	.load2 {
		transform: rotate(30deg)
	}
	
	.load3 {
		transform: rotate(60deg)
	}
	
	.load1 view:nth-child(1) {
		animation-delay: 0s
	}
	
	.load2 view:nth-child(1) {
		animation-delay: .13s
	}
	
	.load3 view:nth-child(1) {
		animation-delay: .26s
	}
	
	.load1 view:nth-child(2) {
		animation-delay: .39s
	}
	
	.load2 view:nth-child(2) {
		animation-delay: .52s
	}
	
	.load3 view:nth-child(2) {
		animation-delay: .65s
	}
	
	.load1 view:nth-child(3) {
		animation-delay: .78s
	}
	
	.load2 view:nth-child(3) {
		animation-delay: .91s
	}
	
	.load3 view:nth-child(3) {
		animation-delay: 1.04s
	}
	
	.load1 view:nth-child(4) {
		animation-delay: 1.17s
	}
	
	.load2 view:nth-child(4) {
		animation-delay: 1.3s
	}
	
	.load3 view:nth-child(4) {
		animation-delay: 1.43s
	}
	
	@-webkit-keyframes load {
		0% {
			opacity: 1
		}
	
		100% {
			opacity: .2
		}
	}
</style>
